package org.note.law.domain;

import io.swagger.annotations.ApiModel;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@ApiModel(value = "markdown节点")
@Data
public class MarkdownNode {
    private String title;
    private int level;
    private List<MarkdownNode> children;
    private StringBuilder content;

    public MarkdownNode(String title, int level) {
        this.title = title;
        this.level = level;
        this.children = new ArrayList<>();
        this.content = new StringBuilder();
    }

    public void addChild(MarkdownNode child) {
        this.children.add(child);
    }

    public void appendContent(String content) {
        this.content.append(content).append("\n");
    }

    public String getContent() {
        return content.toString().trim();
    }
}
